<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>19.2. Migration and Post-Migration script example</title>
		<link type="text/css" rel="stylesheet" href="PLUGINS_ROOT/org.polarsys.capella.doc/html/styles.css"/>
	</head>
	<body>
		<h1 id="Migration_and_Post-Migration_script_example_for_Windows">Migration and Post-Migration script example for Windows</h1>
		<p>Below a batch script (.bat) to first execute a migration of projects given in parameters (zip), then execute 3 command lines on each project after migration: Refresh Representations, Remove Hidden Elements, and Export All Representations as images.</p>
		<p>To execute it:</p>
		<pre>
thisScript.bat #absolutePathToProjectA.zip #absolutePathToProjectB.zip #absolutePathToProjectC.zip
</pre>
		<p>If you migrate a project using libraries, all dependent projects/libraries must be included and the sequence order matters.</p>
		<pre>
@echo off
setlocal enabledelayedexpansion
</pre>
		<p><span style="color: green">rem Mandatory to set</span></p>
		<pre>
set capellaExe=...capella/capellac.exe
set workspacePath=.../workspace
set logFilePath=".../log.html"
</pre>
		<p><span style="color: green">rem compute importedFiles (".../projectA.zip | .../projectB.zip | ...")</span></p>
		<pre>
SET projectsList=
for %%x in (%*) do (
  set projectsList=!projectsList! ^| %%x
)
set importedFiles=!projectsList:~3!
</pre>
		<p><span style="color: green">rem First, execute the migration on the given projects</span></p>
		<pre>
echo Execute migration of all given projects:
@echo on
%capellaExe% -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.migration -data "%workspacePath%" -import "%importedFiles%" -input /all -outputfolder "A_ok/MigrationResult" -backup -logfile "%logFilePath%"
@echo off
echo.
</pre>
		<pre><span style="color: green">rem execute the refreshRepresentations command line</span>
</pre>
		<pre>
  set command1=%capellaExe% -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.refreshRepresentations -data "%workspacePath%" -input /all -unsyncDiags -logfile "%logFilePath%"
  echo !command1!
  call !command1!
  echo.
</pre>
		<pre> <span style="color: green">rem execute the removeHiddenElements command line</span>
</pre>
		<pre>
  set command2=%capellaExe% -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.removeHiddenElements -data "%workspacePath%" -input /all -unsyncDiags -logfile "%logFilePath%"
  echo !command2!
  call !command2!
echo.
</pre>
		<pre> <span style="color: green">rem execute the exportRepresentations command lines and at the end of all commands, all the models are exported to output location "/MigratedProject/output"</span>
</pre>
		<pre>
  set command3=%capellaExe% -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.exportRepresentations  -data "%workspacePath%" -input /all -exportToHTML -exportZip /all -outputfolder /MigratedProject/output
  echo !command3!
  call !command3!
  echo.
)
@echo on
</pre>
	</body>
</html>